package com.lou.springboot.service.impl;

import com.lou.springboot.common.PageResult;
import com.lou.springboot.dao.AdminUserDao;
import com.lou.springboot.entity.AdminUser;
import com.lou.springboot.service.AdminUserService;
import com.lou.springboot.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminUserServiceImpl implements AdminUserService {

    @Autowired
    private AdminUserDao adminUserDao;

    public PageResult getAdminUserPage(PageUtil pageUtil) {
        List<AdminUser> adminUsers = adminUserDao.findAdminUsers(pageUtil);
        int total = adminUserDao.getTotalAdminUser();
        PageResult pageResult = new PageResult(adminUsers, total, pageUtil.getLimit(), pageUtil.getPage());
        return pageResult;
    }
}
